#pragma once

#include "Settings.h"

using namespace System;

namespace Cephei { namespace QL {

	public ref class CSession : public ISession
	{
	private:
		DateTime _evaluationDate;

	public:
		property DateTime EvaluationDate 
		{ 
			virtual DateTime get ()
			{
				return _evaluationDate;
			}
			virtual void set (DateTime value)
			{
				_evaluationDate = value;
			}
		}

	public:
		generic <typename T>
		virtual T With (T t, DateTime evaluationDate)
		{
			Settings::EvaluationDate = _evaluationDate;
			return t;
		}
	};
	
	public ref class CSession_Factory : public ISession_Factory
	{
	public:
		virtual ISession^ Create ()
		{
			return gcnew CSession;
		}
	public:
		virtual ISession^ Create (DateTime effectiveDate)
		{
			ISession^ s = Create ();
			s->EvaluationDate = effectiveDate;
			return s;
		}
	};
}}